{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Usage Load Response",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "interfaceCategory" : {
      "type" : "string",
      "enum" : [ "Usage Processing" ],
      "description" : "CMP categorisation of the job associated with this file."
    },
    "interfaceType" : {
      "type" : "string",
      "enum" : [ "Rated Usage" ],
      "description" : "Sub-categorisation of the job"
    },
    "version" : {
      "type" : "number",
      "minimum" : 1.1,
      "maximum" : 1.1,
      "description" : "The current version of the generic extract file. This must match the corresponding outbound file."
    },
    "transformDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a third-party file was transformed into the format required by CMP"
    },
    "transmitDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a file was sent to or received from a third-party system"
    },
    "externalFileName" : {
      "type" : "string",
      "pattern" : "^([a-zA-Z0-9._-])+$",
      "maxLength" : 100,
      "description" : "Third party file name"
    },
    "networkCode" : {
      "type" : "string",
      "maxLength" : 6,
      "description" : "CMP Network Code"
    },
    "details" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Detail"
      },
      "description" : "A response consists of one or more details which represent usage records"
    }
  },
  "required" : [ "interfaceCategory", "interfaceType", "version", "externalFileName", "networkCode" ],
  "definitions" : {
    "Detail" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "detailSequence" : {
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 999999999,
          "description" : "Unique identifier of the detail record within the file"
        },
        "externalReference" : {
          "type" : "string",
          "maxLength" : 200,
          "description" : "External system unique identifier of the usage record"
        },
        "usageType" : {
          "type" : "string",
          "maxLength" : 2,
          "description" : "Indicates the nature of the usage e.g. voice, text, data"
        },
        "usageDateTime" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "Date and time of the usage record"
        },
        "hierarchyEntity" : {
          "$ref" : "#/definitions/HierarchyEntity",
          "description" : "Represents the subscription the usage is associated with"
        },
        "serialNumber" : {
          "type" : "string",
          "maxLength" : 25,
          "description" : "Serial number for the current usage record"
        },
        "destination" : {
          "type" : "string",
          "maxLength" : 18,
          "description" : "Destination for the current usage record"
        },
        "actualUsageUnits" : {
          "type" : "integer",
          "description" : "Actual usage units for the current usage record"
        },
        "billableUsageUnits" : {
          "type" : "integer",
          "description" : "Billable usage units for the current usage record"
        },
        "usageClassCode" : {
          "type" : "string",
          "maxLength" : 12,
          "description" : "Code for the current usage class"
        },
        "wholesaleCharge" : {
          "type" : "number",
          "minimum" : 0.0,
          "maximum" : 9999999.9999,
          "description" : "Wholesale charge for the current usage record"
        },
        "retailCharge" : {
          "type" : "number",
          "minimum" : 0.0,
          "maximum" : 9999999.9999,
          "description" : "Retail charge for the current usage record"
        },
        "accessCharge" : {
          "type" : "number",
          "minimum" : 0.0,
          "maximum" : 9999999.9999,
          "description" : "Access charge for the current usage record"
        },
        "serviceCharge" : {
          "type" : "number",
          "minimum" : 0.0,
          "maximum" : 9.99999999999E7,
          "description" : "Service charge for the current usage record"
        },
        "allowances" : {
          "type" : "array",
          "minItems" : 0,
          "maxItems" : 10,
          "items" : {
            "$ref" : "#/definitions/Allowances"
          },
          "description" : "List of allowance details this usage record has consumed from"
        },
        "genericNumber" : {
          "type" : "array",
          "minItems" : 0,
          "maxItems" : 4,
          "items" : {
            "$ref" : "#/definitions/GenericNumber"
          },
          "description" : "List of numeric attributes associated with the usage record"
        },
        "genericString" : {
          "type" : "array",
          "minItems" : 0,
          "maxItems" : 10,
          "items" : {
            "$ref" : "#/definitions/GenericString"
          },
          "description" : "List of unique string attributes associated with the usage record"
        },
        "usageClassificationAttributes" : {
          "type" : "array",
          "minItems" : 0,
          "maxItems" : 2147483647,
          "items" : {
            "$ref" : "#/definitions/UsageClassificationAttribute"
          },
          "description" : "List of usage classification attributes for this usage record"
        },
        "mobileCountryCode" : {
          "type" : "string",
          "maxLength" : 3,
          "description" : "Mobile country code"
        },
        "mobileNetworkCode" : {
          "type" : "string",
          "maxLength" : 3,
          "description" : "Mobile network code"
        },
        "usageDirection" : {
          "type" : "string",
          "maxLength" : 2,
          "description" : "Indicates the usage direction (originated or terminated)"
        },
        "discountValue" : {
          "type" : "number",
          "minimum" : 0.0,
          "maximum" : 9999999.9999,
          "description" : "Discount value"
        }
      },
      "required" : [ "detailSequence", "externalReference", "usageType", "usageDateTime", "allowances" ]
    },
    "HierarchyEntity" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "subscriptionId" : {
          "type" : "integer",
          "description" : "Subscription number for the current usage record"
        }
      }
    },
    "Allowances" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "OCSAllowance" : {
          "$ref" : "#/definitions/OCSAllowance",
          "description" : "Represents the allowance configuration that is in use by the OCS . Specify either an OCS Allowance Id or OCS Allowance Instance Id, not both"
        },
        "allowanceConsumption" : {
          "type" : "number",
          "maximum" : 1.0E16,
          "description" : "Represents the amount consumed by this usage record from this allowance"
        },
        "allowancePreEventBalance" : {
          "type" : "number",
          "maximum" : 1.0E16,
          "description" : "Balance of the allowance prior to any consumption from the allowance by this usage record"
        },
        "allowancePostEventBalance" : {
          "type" : "number",
          "maximum" : 1.0E16,
          "description" : "Balance of the allowance post consumption from the allowance by this usage record"
        }
      },
      "required" : [ "allowanceConsumption" ]
    },
    "OCSAllowance" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ocsAllowanceId" : {
          "type" : "string",
          "maxLength" : 100,
          "description" : "Allowance Identifier"
        },
        "ocsAllowanceInstanceId" : {
          "type" : "string",
          "maxLength" : 100,
          "description" : "Allowance Instance Identifier"
        }
      }
    },
    "GenericNumber" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "attributeValue" : {
          "type" : "integer",
          "description" : "Value of the numeric attribute of the usage"
        }
      },
      "required" : [ "attributeValue" ]
    },
    "GenericString" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "attributeValue" : {
          "type" : "string",
          "maxLength" : 100,
          "description" : "Value of the unique string attribute of the usage."
        }
      },
      "required" : [ "attributeValue" ]
    },
    "UsageClassificationAttribute" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "attributeValue" : {
          "type" : "string",
          "maxLength" : 100,
          "description" : "Value of the usage classification attribute of the usage"
        }
      },
      "required" : [ "attributeValue" ]
    }
  }
}